/*
  Copyright © 2010  Vinícius dos Santos Oliveira

      This file is part of Touché.

      Touché is free software: you can redistribute it and/or modify
      it under the terms of the GNU Lesser General Public License as published
      by the Free Software Foundation, either version 3 of the License, or
      (at your option) any later version.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU Lesser General Public License for more details.

      You should have received a copy of the GNU Lesser General Public License
      along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */

#ifndef SCENE_H
#define SCENE_H

#include <QGraphicsScene>
#include <QTime>
#include "stage.h"
#include "stageactor.h"
#include "toucheelement.h"
#include "widgets/pushbuttonitem.h"

#define TOUCHE_SHOULD_SKIP_THIS

#include "elements/photoelement.h"

#undef TOUCHE_SHOULD_SKIP_THIS

namespace Touche
{

    class Scene : public QGraphicsScene
    {
        Q_OBJECT

        int timerId;
        static Stage *m_items;
        QList<PushButtonItem *> bottomBar;
        PhotoWidget *widget;
        QTime time;
        bool modified;

        void addElement(Element *element);

    public:
        Scene(qreal x, qreal y, qreal width, qreal height, QObject *parent = 0);
        bool isModified() const;

    protected:
        void timerEvent(QTimerEvent *event);

    public slots:
        void itemMoved();
        void newStage();
        bool saveStage(const QString &file);
        void loadStage(const QString &file);

    private slots:
        void zoomChanged(uint);
        void addTextItem();
        void addScribbleItem();
        void addAudioItem();
        void add_photo_item();
        void killPhysicsTimer();
        void addFromFile();
    };

} // namespace Touche

inline bool Touche::Scene::isModified() const
{
    return modified;
}

#endif // SCENE_H
